# +----------------------------------------------------------------------
# | Pink [ A modern python web framework ]
# +----------------------------------------------------------------------
# | Copyright (c) 2023 http:#unnnnn.com All rights reserved.
# +----------------------------------------------------------------------
# | Author: chenjianhua <unnnnn@foxmail.com>
# +----------------------------------------------------------------------

from src.pink.controllers import Controller
from src.pink.mail import Mailable, Mail


class Welcome(Mailable):
    def build(self):
        return (
            self.to("1@qq.com")
            .subject("PinkPy 4")
            .from_("joe@PinkPyproject.com")
            .text("Hello from PinkPy!")
            .html("<h1>Hello from PinkPy!</h1>")
        )


class MailableController(Controller):
    def view(self, mail: Mail):
        mail.mailable(Welcome()).send(driver="mailgun")
